package com.kayer.ai.entity;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.ai.chat.messages.Message;

@Data
@NoArgsConstructor //无参构造
//封装Message对象，用于前端展示
public class MessageVO {

    private String role;
    private String content;

    public MessageVO(Message message){
        switch(message.getMessageType()){
            case USER:
                this.role = "user";
                break;
            case ASSISTANT:
                this.role = "assistant";
                break;
            default:
                this.role = "";
                break;
        }
        this.content = message.getText();
    }
}
